﻿using Autofac;
using Microsoft.AspNetCore.Mvc;

namespace FC.BCVP.NET8.Extensions
{
    /// <summary>
    /// Autofac属性注册==>可能需要用到Api的类==>所以这个配置放Api层
    /// </summary>
    public class AutofacPropertityModuleReg : Module
    {
        protected override void Load(ContainerBuilder builder)
        {
            var controllerBaseType = typeof(ControllerBase);
            builder.RegisterAssemblyTypes(typeof(Program).Assembly)
                   .Where(t => controllerBaseType.IsAssignableFrom(t) && t != controllerBaseType)
                   .PropertiesAutowired();
        }
    }
}
